﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClassDB
{
    public class DBFind
    {
        public static bool FindRowSetCurrent(DataGridView aDataGridView, string aColumnName, string aKey)
        {
            bool result = false;
            for (int i = 0; i < aDataGridView.RowCount; i++)
            {
                string TempValue = aDataGridView.Rows[i].Cells[aColumnName].Value.ToString();
                if (TempValue.Equals(aKey))
                {
                    aDataGridView.CurrentCell = aDataGridView.Rows[i].Cells[0];
                    result = true;
                    break;
                }
            }
            return result;
        }

        public static bool FindRow(DataGridView aDataGridView, string aColumnName, string aKey)
        {
            bool result = false;
            for (int i = 0; i < aDataGridView.RowCount; i++)
            {
                string TempValue = aDataGridView.Rows[i].Cells[aColumnName].Value.ToString();
                if (TempValue.Equals(aKey))
                {                    
                    result = true;
                    break;
                }
            }
            return result;
        }
    }
}
